Hello, I have a customer's requirements Microsoft Word document and I have imported it into a DOORS module. Imported module has ID column and main column with Object headings or object text. Objects with object text has one or more paragraphs. Each paragraph may have zero or one or more sentences that have a shall word, Object text paragraphs may have other sentences without shall also. Is there an easy and quick way to know the count of all shall words that are in the module, please? For example, in Microsoft Word I can search for "shall" and I can get count of all shall words that are in the Customer's Word Doc. If I use filter, it gives a count of objects that have shall words. Is there a DOORS feature to give this count? Or do I have to write a DXL script? If I have to write a DXL using "for each object in current module" loop, is there a function that gives count of shall words in the object text or do I have to write my own function to counts shall words in object text? Thanks in advance to the DXL forum helping experts, please. I need to ensure, I have same number of shall words in my imported module as the count in the customer's word doc. Mike
MikeMelon - Thu Sep 25 17:06:43 EDT 2014 |
Re: Count Shall Words in a Module I have searched in this forum and found the following response. But I can not copy and paste the DXL code into text editor. Any suggestions please?
|
Re: Count Shall Words in a Module I have DOORS 9.5 version. Does this version has any feature to count shall words please? |
Re: Count Shall Words in a Module MikeMelon - Thu Sep 25 17:19:39 EDT 2014 I have DOORS 9.5 version. Does this version has any feature to count shall words please? Try or adapt this script (i can't attach file, i don't understand why) Count all words.
// Calcul du nombre d'occurences des mots dans un module |
Re: Count Shall Words in a Module I use the following dxl to count "shall" and "shall_" in a module:
//This DXL Program counts the number of 'shall' statements within the document. Regexp isRequirement = regexp "( shall | shall_)"
Module m = current
filtering off Date d = m."Last Modified On"
infoBox "There are " reqCount " requirements" //- |
Re: Count Shall Words in a Module lhall122 - Thu Oct 30 15:13:43 EDT 2014 I use the following dxl to count "shall" and "shall_" in a module:
//This DXL Program counts the number of 'shall' statements within the document. Regexp isRequirement = regexp "( shall | shall_)"
Module m = current
filtering off Date d = m."Last Modified On"
infoBox "There are " reqCount " requirements" //- You are counting objects containing shall here ... Here a simple snipet using the built in search function to get a proper count ...
int countSubString ( string init, string sub ){
if (null sub) return 0
if (null init) return 0
if (length(sub)>length(init)) return 0
Buffer b = create()
Regexp r = regexp2(sub)
b = init
int start = 0
int count = 0
while ( search(r, b, start) ){
start = start + end(0)
count++
}
delete b; delete r
return count
}
Have fun ! |
Re: Count Shall Words in a Module pommCannelle - Fri Oct 31 10:24:02 EDT 2014 You are counting objects containing shall here ... Here a simple snipet using the built in search function to get a proper count ...
int countSubString ( string init, string sub ){
if (null sub) return 0
if (null init) return 0
if (length(sub)>length(init)) return 0
Buffer b = create()
Regexp r = regexp2(sub)
b = init
int start = 0
int count = 0
while ( search(r, b, start) ){
start = start + end(0)
count++
}
delete b; delete r
return count
}
Have fun !
Thanks a bunch to both Lisa Hall (lhall122) and Rodriguez (pommCannelle), I have pasted below the combination: Again thanks a bunch for all inputs. Mike
//This DXL Program counts the number of 'shall' statements within a DOORS module.
int countSubString(string init, string sub)
Regexp isRequirement = regexp "( shall | shall_)"
Module m = current int countShallWords = 0
filtering off
countShallWords = countSubString(thisText, searchStr) Date d = m."Last Modified On"
infoBox "There are " reqCount " requirements" //-
|
Re: Count Shall Words in a Module MikeMelon - Wed Nov 12 17:16:06 EST 2014
Thanks a bunch to both Lisa Hall (lhall122) and Rodriguez (pommCannelle), I have pasted below the combination: Again thanks a bunch for all inputs. Mike
//This DXL Program counts the number of 'shall' statements within a DOORS module.
int countSubString(string init, string sub)
Regexp isRequirement = regexp "( shall | shall_)"
Module m = current int countShallWords = 0
filtering off
countShallWords = countSubString(thisText, searchStr) Date d = m."Last Modified On"
infoBox "There are " reqCount " requirements" //-
Hi, The search string should include a space before/after the word "shall" so that you don't accidently count marshall as a shall! The regular expression isRequirement contains the space, but I don't see where you are using that in this snippet. Say thanks to Louie to point this out.
Hope this helps, Greg |